﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using DataLib.Common;
using DataLib.Accounts.Bus;

namespace Ewts.BaseData
{
    public partial class VehiclorAdd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ListItem item = new ListItem();
                item.Text = "--请选择--";
                item.Value = "";
                DataLib.BLL.City bllLib = new DataLib.BLL.City();
                dropCity.DataSource = bllLib.GetList("flag1='02'");

                // 处理地
               // dropCity.DataSource = bllLib.GetGraphicCity();
                dropCity.DataTextField = "cityname";
                dropCity.DataValueField = "citycode";
                dropCity.DataBind();
                dropCity.Items.Insert(0, item);
            }

        }

        protected void btnSave_Click(object sender, EventArgs e)
        {

            string strErr = "";
         
            if (this.txtname.Text.Trim().Length == 0)
            {
                strErr += "收货员姓名不能为空！\\n";
            }
            if (dropCity.SelectedValue == "")
            {
                strErr += "请选择城市！\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string city = dropCity.SelectedItem.Text ;
            string name = this.txtname.Text;
            string emploeeno = this.txtemploeeid.Text;


            DataLib.Model.Vehiclor model = new DataLib.Model.Vehiclor();
            model.city = city;
            model.name = name;
            model.emploeeno = emploeeno;

            DataLib.BLL.Vehiclor bll = new DataLib.BLL.Vehiclor();
            bll.Add(model);
            DataLib.Common.MessageBox.ShowAndRedirect(this, "保存成功！", "VehiclorAdd.aspx");

        }


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("VehiclorList.aspx");
        }
    }
}
